<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        section{
            width: 300px;
            height: 300px;
            border: 1px solid red;
            margin: 100px auto 0;
            transform: rotateX(-10deg)rotateY(20deg);
            transform-style: preserve-3d;
            position: relative;
            transition: 1s;
            transform-origin:center center;
        }
        div{
            width: 300px;
            height: 300px;
            position: absolute;
            background: rgb(224, 32, 32);
            text-align: center;
            line-height: 300px;
        }
        div:nth-child(2){
            transform: translateZ(-300px);
            background-color: rgb(233, 166, 66);
        }
        div:nth-child(3){
            transform-origin: top center;
            transform: rotateX(-90deg);
            background-color: rgb(192, 226, 39);
        }
        div:nth-child(4){
            transform-origin: left center;
            transform: rotateY(90deg);
            background-color: rgb(66, 214, 29);
        }
        div:nth-child(5){
            transform-origin: right center;
            transform: rotateY(-90deg);
            background-color: rgb(44, 153, 204);
        }
        div:nth-child(6){
            transform-origin: bottom center;
            transform: rotateX(90deg);
            background-color: rgb(23, 51, 209);
        }
        section:hover{
            transform: rotateZ(180deg);
        }
    </style>
</head>
<body>
    <section>
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
    </section>
</body>
</html>